/********************************************
 * 功能说明: 
 * 模块名称: 
 * 系统名称: 
 * 软件版权: Frank
 * 系统版本: 1.0.0
 * 开发人员: Frank
 * 开发时间: 2019/12/12 10:40
 * 审核人员: 
 * 相关文档: 
 * 修改记录: 修改日期 修改人员 修改说明
 *********************************************/
package com.spring.arch.uaa.repository;

import com.spring.arch.uaa.model.Authority;
import com.spring.arch.uaa.model.Role;
import com.spring.arch.uaa.model.RoleAuthority;
import com.spring.arch.uaa.model.Authority;
import com.spring.arch.uaa.model.Role;
import com.spring.arch.uaa.model.RoleAuthority;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.repository.Repository;

import java.util.List;
import java.util.Optional;
import java.util.UUID;

/**
 * 角色资源权限持久层接口
 *
 * @author Frank
 * @version 1.0.0.1
 * @since 2019/12/12 10:40
 */
@org.springframework.stereotype.Repository
public interface RoleAuthorityRepository extends Repository<RoleAuthority, UUID>, QuerydslPredicateExecutor<RoleAuthority> {

    RoleAuthority save(RoleAuthority model);

    Optional<RoleAuthority> findById(UUID id);

    Page<RoleAuthority> findAll(Pageable pageable);

    void deleteById(UUID id);

    List<RoleAuthority> findByAuthority(Authority resource);

    List<RoleAuthority> findByRole(Role role);

    List<RoleAuthority> findByRoleIn(Iterable<Role> roles);

    void deleteByRole(Role model);

    void deleteByRoleIn(Iterable<Role> roles);

    List<RoleAuthority> saveAll(Iterable<RoleAuthority> roleAuthorities);
}
